﻿<%@ Page Title="" Language="C#" MasterPageFile="~/NewStdMasterPage.Master" AutoEventWireup="true"
    EnableEventValidation="false" CodeBehind="Search.aspx.cs" Inherits="AteneoLibri.Pages.Search" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Ricerca</h2>
    <asp:Panel ID="pnlNumberOfResults" runat="server" Visible="false">
        <asp:Label ID="lblNumberOfResults" runat="server" Text="0"></asp:Label>&nbsp;risultati
        trovati&nbsp;per&nbsp;<asp:Label ID="lblQuery" runat="server" Text="" CssClass="query"></asp:Label>
    </asp:Panel>
    <div style="margin-bottom: 20px;">
        <asp:TextBox ID="SearchField" runat="server" CssClass="StandardTextBox" Height="23px"></asp:TextBox>
        <asp:Button ID="btnSearchBook" runat="server" CssClass="StandardButton" Text="Cerca"
            OnClick="btnSearchBook_Click" />
    </div>
    <div class="LandscapeDataVisualization">
        <asp:GridView ID="gvSearchResults" runat="server" OnPageIndexChanging="gvSearchResults_PageIndexChanging"
            EmptyDataText="Non sono stati trovati libri per questa ricerca" AllowPaging="true"
            AlternatingRowStyle-BackColor="#cccccc" BackColor="#ffffff" CellPadding="2" AutoGenerateColumns="false"
            ShowFooter="true" DataKeyNames="IdBook" PageSize="15" EmptyDataRowStyle-ForeColor="Red">
            <PagerStyle CssClass="cssPager" />
            <Columns>
                <asp:BoundField HeaderText="Titolo" ReadOnly="true" DataField="Title" ItemStyle-Width="150px" />
                <asp:BoundField HeaderText="Autore/i" ReadOnly="true" DataField="Author" ItemStyle-Width="150px" />
                <asp:TemplateField>
                    <HeaderTemplate>
                        <asp:Label ID="Label1" runat="server" Text="Prezzo"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID="lblPrice" runat="server" Text='<%# Eval("SellingPrice", "{0:C}") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <HeaderTemplate>
                        <asp:Label ID="Label1" runat="server" Text="Proprietario"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <a href='UserDetails.aspx?UserId=<%# Eval("UserId") %>'>
                            <asp:Label ID="lblOwner" runat="server" Text='<%# Bind("Owner") %>'></asp:Label></a>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-CssClass="NextGridButton">
                    <ItemTemplate>
                        <asp:ImageButton ID="btnBookDetails" runat="server" CssClass="metroButton" AlternateText="Dettagli del libro"
                            ImageUrl="~/Images/buttons/Next.png" OnClick="btnBookDetails_Click" CommandArgument='<%# Eval("IdBook") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
    <div class="PortraitDataVisualization">
        <asp:GridView ID="gvSearchResultsPortrait" runat="server" OnPageIndexChanging="gvSearchResults_PageIndexChanging"
            EmptyDataText="Non sono stati trovati libri per questa ricerca" AllowPaging="true"
            AlternatingRowStyle-BackColor="#cccccc" BackColor="#ffffff" CellPadding="2" AutoGenerateColumns="false"
            ShowFooter="true" DataKeyNames="IdBook" PageSize="15" EmptyDataRowStyle-ForeColor="Red">
            <Columns>
                <asp:TemplateField ItemStyle-Width="240px">
                    <HeaderTemplate>
                        <asp:Label ID="Label1" runat="server" Text="Risultati trovati"></asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <i>Titolo</i>: <asp:Label ID="lblTitle" runat="server" Text='<%# Eval("Title") %>'></asp:Label><br />
                        <i>Autore/i</i>: <asp:Label ID="lblAuthor" runat="server" Text='<%# Eval("Author") %>'></asp:Label><br />
                        <br />
                        <i>Prezzo</i>: <asp:Label ID="lblPrice" runat="server" Text='<%# Eval("SellingPrice", "{0:C}") %>'></asp:Label><br />
                        <i>Proprietario</i>: <a href='UserDetails.aspx?UserId=<%# Eval("UserId") %>'>
                            <asp:Label ID="lblOwner" runat="server" Text='<%# Bind("Owner") %>'></asp:Label></a>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-CssClass="NextGridButton">
                    <ItemTemplate>
                        <asp:ImageButton ID="btnBookDetails" runat="server" CssClass="metroButton" AlternateText="Dettagli del libro"
                            ImageUrl="~/Images/buttons/Next.png" OnClick="btnBookDetails_Click" CommandArgument='<%# Eval("IdBook") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
</asp:Content>
